/*
+----------------------------------------------------------------------+
| CORE                                                                 |
+----------------------------------------------------------------------+
| Copyright © 2013 - 2018, The Machine Studio.                         |
+----------------------------------------------------------------------+
| See https://gitee.com/signorinotang/ServerStudy for last version     |
|                                                                      |
+----------------------------------------------------------------------+
| Author: Donney <Email: donney_luck@sina.cn>                        |
|                <QQ: 116297528>                                       |                                                                     |
+----------------------------------------------------------------------+
*/

#ifndef CORE_ALLOCATOR_H
#define CORE_ALLOCATOR_H
#include <cstdint>

namespace core {
	// allocator base class
	class Allocator {
	public:
		static const uint32_t DEFAULT_ALIGN = 4;
		static const uint32_t SIZE_NOT_TRACKED = 0xffffffff;

		Allocator() = default;
		Allocator(const Allocator& other) = delete;
		Allocator& operator = (const Allocator& other) = delete;		
		virtual ~Allocator() = default;	
		virtual void* Allocate(uint32_t size, uint32_t align = DEFAULT_ALIGN) = 0;
		virtual void Free(void* p) = 0;
		virtual uint32_t GetAllocatedSize(void *p) = 0;
		virtual uint32_t GetTotalAllocated() = 0;
	};
}

#endif
